$import( "SmitearWebGL.Objects.Parser.Collada.DaeEntity" );

SmitearWebGL.Objects.Parser.Collada.DaeArray = SmitearWebGL.Objects.Parser.Collada.DaeEntity.extend(
{
	/******** constructor ********/

	init : function( document, node )
	{
		this._super( document, node );
		this._registClass( "SmitearWebGL.Objects.Parser.Collada.DaeArray" );
	}
	,
	read : function( node )
	{
		this._super( node );

		this.count = 0;
		this.values = this._getData( node );

		$THROW( this.values, " no data!" );
	}
	,
	_getData : function( node )
	{
		var children = node.childNodes;

		for( var i = 0; i < children.length; i++ )
		{
			var child = children[i];

			switch( child.localName )
			{
				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_BOOL_ARRAY_ELEMENT:
					this.count = this.getAttributeAsInt(child, SmitearWebGL.Objects.Parser.Collada.Const.DAE_COUNT_ATTRIBUTE);
					return this.getBools( child );

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_INT_ARRAY_ELEMENT:
					this.count = this.getAttributeAsInt(child, SmitearWebGL.Objects.Parser.Collada.Const.DAE_COUNT_ATTRIBUTE);
					return this.getInts( child );

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_IDREF_ARRAY_ELEMENT:
					this.count = this.getAttributeAsInt(child, SmitearWebGL.Objects.Parser.Collada.Const.DAE_COUNT_ATTRIBUTE);
					return this.getStrings( child );

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_FLOAT_ARRAY_ELEMENT:
					this.count = this.getAttributeAsInt(child, SmitearWebGL.Objects.Parser.Collada.Const.DAE_COUNT_ATTRIBUTE);
					return this.getFloats( child );

				case SmitearWebGL.Objects.Parser.Collada.Const.DAE_NAME_ARRAY_ELEMENT:
					this.count = this.getAttributeAsInt(child, SmitearWebGL.Objects.Parser.Collada.Const.DAE_COUNT_ATTRIBUTE);
					return this.getStrings( child );

				default:
				break;
			}
		}

		return null;
	}
}
);